<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
require_once($CFG->dirroot . '/config.php');
require_once($CFG->dirroot . '/theme/onestep/renderers.php');
require_once($CFG->dirroot . '/question/engine/renderer.php');
require_once($CFG->dirroot . '/question/type/rendererbase.php');
require_once($CFG->dirroot . '/question/type/multichoice/renderer.php');

/*
class theme_onestep_core_question_renderer  extends core_question_renderer{

	protected function info(question_attempt $qa, qbehaviour_renderer $behaviouroutput,
            qtype_renderer $qtoutput, question_display_options $options, $number) {
		$output = '';
		$output .= $this->number($number);
		$output .= $this->status($qa, $behaviouroutput, $options);
		$output .= $this->mark_summary($qa, $behaviouroutput, $options);
		$output .= $this->question_flag($qa, $options->flags);
		$question = $qa->get_question();
		$tags =  core_tag_tag::get_item_tags_array('core_question', 'question', $question->id);

		$t = '';
		$i=1;
		$c = count($tags);
		foreach($tags as $key=>$value){
			$params['id'] = $key;
			$url = new moodle_url('/tag/index.php', $params);
			if($c==1){			
				$t .= html_writer::link($url,get_string('point', 'theme_' . $this->page->theme->name));
			}else{
				$t .= html_writer::link($url, get_string('point', 'theme_' . $this->page->theme->name). $i . '  ');
			}
			$i = $i+1;
		}
		if($c>0){
			$output .= '<p style="color:red;">' .  get_string('click', 'theme_' . $this->page->theme->name) . $t .  get_string('enhence', 'theme_' . $this->page->theme->name) . '</p>'; 
		}
		
		$output .= $this->edit_question_link($qa, $options);
		return $output;
	}
}
*/

class theme_onestep_qtype_multichoice_single_renderer  extends qtype_multichoice_single_renderer{
/*	
	public function feedback(question_attempt $qa, question_display_options $options) {
		global $CFG;
		$output = '';
        $hint = null;
        if ($options->feedback) {
            $output .= html_writer::nonempty_tag('div', $this->specific_feedback($qa),
                    array('class' => 'specificfeedback'));
            $hint = $qa->get_applicable_hint();
        }
        if ($options->numpartscorrect) {
            $output .= html_writer::nonempty_tag('div', $this->num_parts_correct($qa),
                    array('class' => 'numpartscorrect'));
        }
        if ($hint) {
            $output .= $this->hint($qa, $hint);
        }
        if ($options->generalfeedback) {  
			$tags = core_tag_tag::get_item_tags('core_question','question',$qa->get_question()->id);
			$o = '';
		
			foreach ($tags as $key => $val) {
				$o .= " <a href='{$CFG->wwwroot}/tag/index.php?id={$val->id}' class='btn btn-sm btn-danger' role='button'>{$val->rawname}</a>";
			}
			$c = '<p>' . get_string('click', 'theme_' . $this->page->theme->name) . $o . get_string('enhence', 'theme_' . $this->page->theme->name) . '</p>';
            $output .= html_writer::nonempty_tag('div', $this->general_feedback($qa) . $c,
                    array('class' => 'generalfeedback'));
        }
        if ($options->rightanswer) {
            $output .= html_writer::nonempty_tag('div', $this->correct_response($qa),
                    array('class' => 'rightanswer'));
        }

        return $output;
    }
*/
    protected function prompt() {
        return '';
    }	
}
 

class theme_onestep_qtype_multichoice_multi_renderer  extends qtype_multichoice_multi_renderer{
/*
	public function feedback(question_attempt $qa, question_display_options $options) {
		global $CFG;
		$output = '';
        $hint = null;
        if ($options->feedback) {
            $output .= html_writer::nonempty_tag('div', $this->specific_feedback($qa),
                    array('class' => 'specificfeedback'));
            $hint = $qa->get_applicable_hint();
        }
        if ($options->numpartscorrect) {
            $output .= html_writer::nonempty_tag('div', $this->num_parts_correct($qa),
                    array('class' => 'numpartscorrect'));
        }
        if ($hint) {
            $output .= $this->hint($qa, $hint);
        }
        if ($options->generalfeedback) {  
			$tags = core_tag_tag::get_item_tags('core_question','question',$qa->get_question()->id);
			$o = '';
		
			foreach ($tags as $key => $val) {
				$o .= " <a href='{$CFG->wwwroot}/tag/index.php?id={$val->id}' class='btn btn-sm btn-danger' role='button'>{$val->rawname}</a>";
			}
			$c = '<p>' . get_string('click', 'theme_' . $this->page->theme->name) . $o . get_string('enhence', 'theme_' . $this->page->theme->name) . '</p>';
            $output .= html_writer::nonempty_tag('div', $this->general_feedback($qa) . $c,
                    array('class' => 'generalfeedback'));
        }
        if ($options->rightanswer) {
            $output .= html_writer::nonempty_tag('div', $this->correct_response($qa),
                    array('class' => 'rightanswer'));
        }

        return $output;
    }
*/
    protected function prompt() {
        return '';
    }
}
